home *** CD-ROM | disk | FTP | other *** search
- unit AnimateDemoForm;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- ExtCtrls, StdCtrls;
-
- type
- TForm1 = class(TForm)
- Memo1: TMemo;
- CheckBox1: TCheckBox;
- Panel1: TPanel;
- Edit1: TEdit;
- procedure FormShow(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- const
- // LWA constants for SetLayeredWindowAttributes
- lwa_ColorKey = 1;
- lwa_Alpha = 2;
-
- // New extended window style for layering
- ws_Ex_Layered = $80000;
-
- // AnimateWindow flags
- aw_Hor_Positive = $00000001;
- aw_Hor_Negative = $00000002;
- aw_Ver_Positive = $00000004;
- aw_Ver_Negative = $00000008;
- aw_Center = $00000010;
- aw_Hide = $00010000;
- aw_Activate = $00020000;
- aw_Slide = $00040000;
- aw_Blend = $00080000;
-
- function SetLayeredWindowAttributes (Wnd: hWnd; crKey: ColorRef; bAlpha: Byte; dwFlags: DWord): Bool; stdcall;
- external 'user32.dll';
-
- function UpdateLayeredWindow (Wnd: hWnd; hdcDst: HDC; var pptDst: TPoint;
- var psize: TSize; hdcSrc: HDC; var pptSrc: TPoint;
- crKey: ColorRef; var pblend: BlendFunction; dwFlags: DWord): Bool; stdcall;
- external 'user32.dll';
-
- function AnimateWindow (Wnd: hWnd; dwTime, dwFlags: DWord): Bool; stdcall;
- external 'user32.dll';
-
- procedure TForm1.FormShow(Sender: TObject);
- begin
- AnimateWindow (Handle, 200, aw_Hor_Positive);
- end;
-
- procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- AnimateWindow (Handle, 400, aw_Hor_Negative or aw_Hide);
- end;
-
- end.
-